import request from '@/utils/request'

//    /my/cate/del delete 删除分类

export const cateDeleteService = (id) => {
  return request.delete(`/my/cate/del/?id=${id}`)
}

// /my/cate/info get 获取文章分类信息
export const cateInfoService = (id) => {
  return request.get(`/my/cate/info?id=${id}`)
}

//   /my/cate/info put 修改文章分类
// {
//     "id": 1070,
//     "cate_name": "科技好",
//     "cate_alias": "kejih"
//   }
export const cateUpdateService = (data) => {
  return request.put('/my/cate/info', data)
}

// /my/cate/add  post 新增文章分类
// {
//     "cate_name": "娱乐",
//     "cate_alias": "yule"
//   }
export const cateAddService = (data) => {
  return request.post('/my/cate/add', data)
}

//  /my/cate/list get 获取文章分类列表
export const cateListService = () => {
  return request.get('/my/cate/list')
}

//     /my/article/info     put 获取文章详情
// {
//     "ID": '1070'
//     "title": "科技好",
//    'cate_id': '1070',
//    'content': '科技好',
//    'cover_img': file对象,
//    'state': '已发布'
// }
export const articleInfoPutService = (data) => {
  return request.put('/my/article/info', data)
}

//       /my/article/add post 新增文章发布文章
export const articleAddService = (data) => {
  return request.post('/my/article/add', data)
}

//       /my/article/info get 获取文章详情
export const articleInfoService = (id) => {
  return request.get(`/my/article/info?id=${id}`)
}

//    /my/article/info delete 删除文章
export const articleDeleteService = (id) => {
  return request.delete(`/my/article/info?id=${id}`)
}

//     /my/article/list get 获取文章列表
export const artGetListService = (params) =>
  request.get('/my/article/list', { params })
